Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: data-disabled CSS selector for DateField #7896

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

suyash5053
Copy link

Closes #7890

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@suyash5053
Copy link
Author

@snowystinger Yeah Sure, I was waiting to see whether I'm on the right track or not. Will write the test cases :).

@suyash5053 suyash5053 requested a review from snowystinger March 10, 2025 00:45
@suyash5053
Copy link
Author

Hey @snowystinger, I have added some test cases, feel free to suggest me some more if needed.

A different question is, in TimeField we also see the disabled state but there are no test cases related to them. Is this an issue or we just left them knowingly?

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tests, I left some comments

defaultValue={new CalendarDate(2020, 2, 3)}
validationBehavior="aria"
isDisabled>
{({isInvalid, isDisabled}) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this one added? I see no assertion against it

@@ -286,6 +293,81 @@ describe('DateField', () => {
expect(group).not.toHaveAttribute('data-invalid');
});

it('should support both invalid and disabled states simultaneously', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it need to support them simultaneously? a disabled control can't be invalid, it's essentially invisible to everyone

expect(group).toHaveClass('disabled');
});

it('should use controlled disabled state', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unneeded, it's not testing anything different than what the first test should be checking

expect(group).toHaveClass('disabled');
});

it('should not validate on submit when disabled', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe anything in this PR altered this behaviour, did you run into some issues with this? or what inspired this test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data-disabled CSS selector not added to DateField
2 participants